home *** CD-ROM | disk | FTP | other *** search
/ CU Amiga Super CD-ROM 23 / CU Amiga - Super CD-ROM 23 (June 1998).iso / CUCD / Programming / OUI / rcs / gadget.cc < prev    next >
Encoding:
C/C++ Source or Header  |  1998-04-08  |  2.1 KB  |  133 lines

  1. head    1.3;
  2. access;
  3. symbols;
  4. locks
  5.     dlorre:1.3; strict;
  6. comment    @// @;
  7.  
  8.  
  9. 1.3
  10. date    97.09.17.08.15.46;    author dlorre;    state Exp;
  11. branches;
  12. next    1.2;
  13.  
  14. 1.2
  15. date    97.07.14.04.22.49;    author dlorre;    state Exp;
  16. branches;
  17. next    1.1;
  18.  
  19. 1.1
  20. date    96.08.22.02.05.10;    author dlorre;    state Exp;
  21. branches;
  22. next    ;
  23.  
  24.  
  25. desc
  26. @Oui.lib -- Object User Interface
  27. Projet créé en 1994
  28. Auteur: Dominique Lorre
  29. @
  30.  
  31.  
  32. 1.3
  33. log
  34. @case miscmatch
  35. @
  36. text
  37. @// $Id: gadget.cc 1.2 1997/07/14 04:22:49 dlorre Exp dlorre $
  38. #include <libraries/gadtools.h>
  39.  
  40. #include "gadgets/gadget.h"
  41. #include "gadgetlist.h"
  42. #include <ctype.h>
  43. #include <mydebug.h>
  44.  
  45. // ========================================================================
  46. // ==========================  GADGET CLASS ===============================
  47. // ========================================================================
  48.  
  49.  
  50. gadget::gadget(gadgetlist *gl,
  51.                void (window::*func)(gadget *, unsigned long, unsigned short)
  52.                ) : glist(gl), gfunc(func), gad(NULL)
  53. {
  54.     gl->ng->ng_LeftEdge = gl->left ;
  55.     gl->ng->ng_TopEdge = gl->top ;
  56.     gl->ng->ng_Width = gl->width ;
  57.     gl->ng->ng_Height = gl->height ;
  58.     id = gl->ng->ng_GadgetID = gl->count ;
  59.     gl->gtab[gl->count] = this ;
  60.     gl->count++ ;
  61.     w = gl->wp ;
  62.     key = '\0' ;
  63. }
  64.  
  65. void gadget::action(unsigned long classe, unsigned short code)
  66. {
  67.     if (gfunc) (glist->win->*gfunc)(this, classe, code) ;
  68. }
  69.  
  70. void gadget::select(BOOL sel)
  71. {
  72. }
  73.  
  74. void gadget::keystroke(BOOL shifted)
  75. {
  76. }
  77.  
  78. void gadget::underkey(const char *s)
  79. {
  80. int i ;
  81.  
  82.     key = '\0' ;
  83.     if (s && *s) {
  84.         for (i=1 ; s[i] ; i++) {
  85.             if (s[i-1] == '_' ) {
  86.                 key = tolower(s[i]) ;
  87.                 break ;
  88.             }
  89.         }
  90.     }
  91. }
  92.  
  93. @
  94.  
  95.  
  96. 1.2
  97. log
  98. @*** empty log message ***
  99. @
  100. text
  101. @d1 1
  102. a1 1
  103. // $Id$
  104. d50 1
  105. a50 1
  106.                 key = toupper(s[i]) ;
  107. @
  108.  
  109.  
  110. 1.1
  111. log
  112. @Initial revision
  113. @
  114. text
  115. @d1 1
  116. d6 2
  117. a28 5
  118. void gadget::setfunc(void (window::*func)(gadget *, unsigned long, unsigned short))
  119. {
  120.     gfunc = func ;
  121. }
  122.  
  123. a37 1
  124.  
  125. d42 1
  126. a42 1
  127. void gadget::underkey(STRPTR s)
  128. d50 2
  129. a51 1
  130.                 key = char(s[i] | 0x20) ;
  131. d56 1
  132. @
  133.